Skip to content

An assistant answer cites Loom's docs as [help:], checked against the shipped pages, and an invented op or setting name makes it unsupported - #498

Merged
zlareb1 merged 2 commits into
mainfrom
feat/assistant-help-citations
Nov 10, 2026
Merged

zlareb1 merged 2 commits into
mainfrom
feat/assistant-help-citations

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Related: #488

Changelog category (leave one):

  • New Feature

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

An assistant answer about how Loom works cites the documentation it used as [help:<page> § <section>]; Loom checks each citation against the docs the server ships, and the dashboard links a verified one to a new Help page at that section. An answer that names an op or setting the server neither serves nor documents is marked unsupported, and the names are listed in unknown_names.

Why

#488 gave the assistant help.search and help.get, but its answers could only name a docs page in words, which nothing checks, and the support label could not tell a docs answer from an unsupported one. This PR makes a docs answer cite its sources the way a memory or document answer does, and holds the answer to the instruction "never invent an op or setting name".

Design (also in docs/architecture/assistant.md: the help citation and Names paragraphs of the citation check, and the Support section):

  • Help citation. [help:<path>] or [help:<path> § <Title > A > B>], the breadcrumb as help.search returns it. The bridge checks it in process against the replica's own docs index, with no read of Loom's and no HTTP. It is verified when the page is indexed and the section is one of the page's own: its full breadcrumb, the breadcrumb without the page title, or a tail of it that no other section of the page shares (a model often writes the heading alone). A page or section that is not there fails the way a document citation does (no_document, no_section), and docs that cannot be read leave it not_run. A verified help citation carries anchor, the section's slug.

  • Names. The tool results stay with the agent, so the bridge checks what it can decide. A backticked dotted name whose first part is an op group, or any LOOM_* name, is known when one of these holds:

    • the build serves it as an op;
    • the build reads it as an environment variable: a setting, NON_SETTINGS_ENV, or a prefix family;
    • the shipped docs write it as an identifier.

    A name ending in _ is a family. The rest are returned in unknown_names, and the answer's support is unsupported whatever it cites. With no docs to read, none is reported. A name in prose, without backticks or the LOOM_ prefix, is not checked.

  • Help page. The dashboard view help, at /help?page=<path>#<anchor> (the view keeps ?page= through boot and navigation), renders help.get under the signed-in session, so the docs are not exposed publicly. A long page is read to its end by following next_offset, at most 20 reads. Each heading takes the anchor of the next outline entry the page writes the same way: help.get's outline now carries each heading's text as written, so the dashboard never computes an anchor. It reuses the answer renderer's blocks through a new renderBlocks(text, spans), adding heading anchors and links between pages:

    • only a relative link into the docs (another page, or a section of this one) becomes a link, and following one stays in the view;
    • every other target (external, image, contributor page, above the docs root) shows as text;
    • answers stay link-free, as before.
  • Sources. A verified help citation opens the Help page at its section through the store, as a memory or document opens. When an answer is unsupported for an unknown name, its label names the name.

  • Instructions. The agent cites each docs section it uses as [help:...], never as [doc:], and writes op and setting names in backticks only as a tool returned them. The agent definition moves to version 6.

Scope and risk

  • Server: server/assistant/ (citation parse and check, the name check in domain/names.py, the support rule's unknown_names), plus a lookup and an identifier set on the help index.
  • Dashboard: a new Help view, its renderer, and the help link in Sources.tsx.
  • SDKs: the clients parse anchor and unknown_names.
  • Nothing is stored, and tenant data is not read for a help citation.
  • A false "unknown" marks a correct answer unsupported. To keep that rare, the check counts every identifier the shipped docs write as known, and checks only op-group dotted names and LOOM_* names. The tests pin which names count (test_assistant_help_citations.py).

Compatibility, rollout and rollback

  • Wire:
    • AssistantCitation.kind gains help, and the citation gains anchor.
    • assistant.ask, the chat route's whole answer and the loom.citations event gain unknown_names.
    • Clients that read kind as a string are unaffected.
  • Operator steps: none.
  • Rolling upgrade: the newest build writes agent definition 6. A bridge of an earlier build does not parse [help:], so an answer resting only on help citations shows as none there until the upgrade ends. A dashboard of this build reading a page from an earlier replica gets no outline headings, so a Sources link opens that page at its top rather than at the cited section, also until the upgrade ends.
  • Rollback: nothing stored. An older build leaves definition 6 in place, and its bridge treats [help:] as text.

Tests

  • tests/unit/test_assistant_help_citations.py:
    • help citations parsed, verified with their anchor, or failed with their code; a section found without its page title or by a unique tail;
    • unchecked with no docs, where no name is reported either;
    • which names count as unknown.
  • tests/unit/test_assistant_support.py: an answer naming an unknown name is unsupported whatever it cites.
  • tests/unit/test_assistant_bridge.py: unknown_names and the label reach the stream, the whole answer and assistant.ask.
  • SDK tests in Python and TypeScript: anchor and unknown_names are parsed.
  • Dashboard:
    • HelpText.test.tsx: anchors taken from the outline by heading text (a setext heading or a repeated one shifts none), the links it makes and refuses (a link inside a code span is code), and no images or HTML;
    • help.test.ts: a long page read to its end by offset; a deep link's page and anchor kept through boot; a move between sections of one page gets its own history entry;
    • Help.test.tsx: reads the page, scrolls to the anchor (again when a second link opens another section of the same page), follows a link in place, tolerates a malformed anchor, and handles a missing page or no docs;
    • Chat.test.tsx: a verified help citation opens its section on the Help view, the answer's text draws no link, and an unknown name is named in the label.
  • Ran: make format, make lint and make typecheck. The assistant, help, SDK, census, doc-link and public-copy unit tests: 713 passed. The whole dashboard suite: 2,384 passed. npm run build and the bundle budget passed. The TypeScript SDK check passed.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. The design went through six adversarial architecture reviews to zero findings before the build, and each part is covered by the tests above.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

@zlareb1
zlareb1 force-pushed the feat/assistant-help-citations branch from 3715320 to 3c9008d Compare November 10, 2026 19:41
zlareb1 and others added 2 commits November 10, 2026 20:19
… shipped pages, and an invented op or setting name makes it unsupported

A help citation names a page of the docs the build ships and optionally a
section; the bridge checks it against the process's own index and returns the
section's anchor, which the dashboard's Sources open on a new Help page. The
bridge also lists the backticked op and LOOM_* names an answer writes that the
build neither serves nor documents; an answer with one is unsupported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant